using System.Collections;
using System.Security.Cryptography;
using System.Web.SessionState;
using System.Web.UI.MobileControls;
using EqRepair.Code.Enums;

namespace EqRepair.Code.Classes
{

	public static class SessionExtender
	{
		private const string CURRENT_USER_ROLE_KEY = "current_user_role";
		private const string CURRENT_USER_ID_KEY = "current_user_id";
		private const string CURRENT_USER_FULLNAME_KEY = "current_user_fullname";

		public static EmployeeRole? GetCurrentUserRole(this HttpSessionState session)
		{
			var obj = session[CURRENT_USER_ROLE_KEY];
			return obj == null ? null : new EmployeeRole?((EmployeeRole)obj);
		}

		public static bool IsUserLogIn(this HttpSessionState session)
		{
			return session[CURRENT_USER_ID_KEY] != null;
		}

		public static string GetCurrentUserFullName(this HttpSessionState session)
		{
			return (string)session[CURRENT_USER_FULLNAME_KEY];
		}

	}
}